package com.yongninger.adapter;

import java.util.HashMap;
import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.yongninger.activity.R;

public class ProductListViewAdapter extends ListViewAdapter {
	public ProductListViewAdapter(Context context,
			List<HashMap<String, Object>> items) {
		super(context, items);
	}

	@Override
	public View getView(int position, View view, ViewGroup parent) {
		if (view == null) {
			view = inflater.inflate(R.layout.product_item, null);
		}
		TextView pname = (TextView) view.findViewById(R.id.pname);
		pname.setText(items.get(position).get("pname").toString());
		TextView pprice = (TextView) view.findViewById(R.id.pprice);
		pprice.setText(items.get(position).get("pprice").toString());
		TextView smeasure1 = (TextView) view.findViewById(R.id.smeasure1);
		smeasure1.setText(items.get(position).get("smeasure1").toString());
		TextView smeasure2 = (TextView) view.findViewById(R.id.smeasure2);
		smeasure2.setText(items.get(position).get("smeasure2").toString());
		TextView pcategory = (TextView) view.findViewById(R.id.pcategory);
		pcategory.setText(items.get(position).get("pcategory").toString());
		return view;
	}
}
